package com.chen.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chen.common.Result;
import com.chen.mapper.PictureMapper;
import com.chen.pojo.Picture;
import com.chen.service.PictureService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class PictureServiceImpl extends ServiceImpl<PictureMapper, Picture> implements PictureService {

    @Resource
    private PictureMapper pictureMapper;

    //添加图片
    public Result<?> addPicture(Picture picture) {
        picture.setTime(new Date());
        return Result.success(pictureMapper.insert(picture));
    }

    //删除图片
    public Result<?> deletePicture(Long id) {
        return Result.success(pictureMapper.deleteById(id));
    }

    //查询图片
    public Result<?> queryAll(){

        return Result.success(pictureMapper.selectList(null));
    }






}
